<body>
    <script>
        var d = new Date
        console.log(d.getFullYear())//获取年
        console.log(d.getMonth())//获取月 0~11
        console.log(d.getDate())//获取天
        console.log(d.getDay())//获取星期几
        console.log(d.getHours())
    </script>
</body>